﻿Public Class InmuebleNegocio

    Function insertarInmueble(ByVal a As Integer, ByVal b As Integer, ByVal c As String, ByVal d As Integer, ByVal e As String, ByVal f As Integer, ByVal g As String, ByVal h As String, ByVal i As String, ByVal j As String, ByVal k As String, ByVal l As Integer)

        Dim modelo As New Inmueble()

        modelo.idDueño = a
        modelo.idCentroEstudio = b
        modelo.Fecha = c
        modelo.Precio = d
        modelo.Direccion = e
        modelo.NumPiso = f
        modelo.TipoInmueble = g
        modelo.Foto1 = h
        modelo.Foto2 = i
        modelo.Estado = j
        modelo.GoogleMap = k
        modelo.Valoracion = l


        Dim dao As New InmuebleDAO
        Try
            Return dao.insertar(modelo)
        Catch ex As Exception
            Throw ex
        End Try

    End Function

    Public Sub actualizar(ByVal idInmueble As Integer, ByVal precio As Integer, ByVal foto1 As String, ByVal foto2 As String, ByVal estado As String, ByVal valoracion As Integer)

        Dim modelo As New Inmueble()
        modelo.idInmueble = idInmueble

        modelo.Precio = precio
        modelo.Foto1 = foto1
        modelo.Foto2 = foto2
        modelo.Estado = estado
        modelo.Valoracion = valoracion



        Dim dao As New InmuebleDAO
        dao.actualizar(modelo)
    End Sub


    Public Function obtener(ByVal idInmueble As Integer) As Inmueble
        Dim dao As New InmuebleDAO
        Return dao.obtener(idInmueble)
    End Function


    Public Function buscarPorNombre(ByVal estado As String) As Collection
        Dim dao As New InmuebleDAO
        Return dao.buscarPorNombre(estado)
    End Function

    Public Function listar() As Collection
        Dim dao As New InmuebleDAO
        Return dao.listar()
    End Function



    Public Sub eliminar(ByVal idInmueble As Integer)
        Dim dao As New InmuebleDAO
        dao.eliminar(idInmueble)
    End Sub


End Class
